USE [PeDALS_DEV]
GO

/****** Object:  StoredProcedure [dbo].[PAC_UpdateSeriesAcquisition]    Script Date: 10/21/2009 14:09:02 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

/* 
 * PROCEDURE: PAC_UpdateSeriesAcquisition 
 */



/* 
 * PROCEDURE: PAC_UpdateSeriesAcquisition 
 */

ALTER PROCEDURE [dbo].[PAC_UpdateSeriesAcquisition]
	(@SeriesAcquisitionId INT,
	 @SeriesAcquisitionReceivedDate DATETIME,
	 @SeriesAcquisitionIngestDate DATETIME,
	 @SeriesAcquisitionAccessionNumber VARCHAR (50),
	 @SeriesAcquisitionTransferAuthority VARCHAR (50),
	 @SeriesAcquisitionSource VARCHAR (100),
	 @SeriesAcquisitionDirectory VARCHAR (255),
	 @SeriesAcquisitionIngested VARCHAR (12),	 
	 @SeriesAcquisitionGeneralNote VARCHAR (MAX))

AS
BEGIN
	TRY
	SET NOCOUNT ON
	BEGIN TRANSACTION
		UPDATE [PeDALS_DEV].[dbo].[SeriesAcquisition]
		 SET [SeriesAcquisitionReceivedDate] = @SeriesAcquisitionReceivedDate
		  ,[SeriesAcquisitionIngestDate] = @SeriesAcquisitionIngestDate
		  ,[SeriesAcquisitionAccessionNumber] = @SeriesAcquisitionAccessionNumber
		  ,[SeriesAcquisitionTransferAuthority] = @SeriesAcquisitionTransferAuthority
		  ,[SeriesAcquisitionSource] = @SeriesAcquisitionSource
	      ,[SeriesAcquisitionDirectory] = @SeriesAcquisitionDirectory
	      ,[SeriesAcquisitionIngested] = @SeriesAcquisitionIngested
		  ,[SeriesAcquisitionGeneralNote] = @SeriesAcquisitionGeneralNote	
		  ,[ModifiedDate] = GETDATE()
		  ,[ModifiedBy] = 'Cataloger'
	WHERE [SeriesAcquisitionId] = @SeriesAcquisitionId	
	COMMIT TRANSACTION
END TRY
BEGIN CATCH
      ROLLBACK TRANSACTION
		PRINT 'An error occurred.  Please notify your administrator to check the error database.'
		INSERT INTO [PEDALS_PAC_ERRORS].[dbo].[PAC_ERROR](ErrorNumber, ErrorMessage, CreatedDate)
			VALUES (ERROR_NUMBER(), ERROR_MESSAGE(), GETDATE())
END CATCH

GO


